package com.desin.modle.behavioral.observer;

import java.util.Observable;
import java.util.Observer;

//观察者
public class Teacher implements Observer {
    private String teacherName;

    public Teacher(String teacherName) {
        this.teacherName = teacherName;
    }

    @Override
    public void update(Observable o, Object arg) {
        Course course = (Course) o;
        Question question = (Question)arg;

        System.out.println(teacherName + "老师收到了" + question.getUserName()
        + "对" + course.getCourseName() +"的问题");
    }
}
